package net.ojbk.study.curriculumDesign.service.impl.canvasmodel;

import net.ojbk.study.curriculumDesign.beans.canvasmodel.Category;
import net.ojbk.study.curriculumDesign.dao.canvasmodel.CategoryDao;
import net.ojbk.study.curriculumDesign.service.canvasmodel.ICategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("categoryService")
public class CategoryServiceImpl implements ICategoryService {
    @Autowired
    @Qualifier("categoryDao")
    private CategoryDao categoryDao;

    /* 方法用途对应接口中注释*/
    @Override
    public List<Category> getCategories() {
        return categoryDao.selectAll();
    }

    @Override
    public void deleteById(Integer cgid) {
        categoryDao.deleteById(cgid);

    }

    @Override
    public void addCategory(Category category) {
        categoryDao.insertOne(category);
    }
}
